using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using ShopForWeb.UI.Models;

namespace ShopForWeb.UI.Controllers
{
    [Route("[controller]")]
    public class PassageController : Controller
    {
        
        [HttpGet("title")]
        public IActionResult GetStudentByTitle([FromQuery]string title){
            return Json(new{Title=title});
        }

        [HttpGet("author")]
        public IActionResult GetStudentByAuthor([FromQuery]string author){
            return Json(new {Author = author});
        }

        [HttpPost]

        public IActionResult AddNewPassage([FromForm]Passage passage){
            return Json(passage);
        }

        [HttpPut]
         public IActionResult UpdatePassage([FromBody]Passage passage){
            return Json(passage);
         }

         [HttpDelete ("title")]
         public IActionResult DelTitle([FromQuery]String title){
            return Json(new{Title= title });
         }

    }
}